# leetcode 828 统计子串中的唯一字符


# 暴力解法，超时
class Solution:
    def uniqueLetterString(self, s: str) -> int:
        n = len(s)
        ret = 0
        for i in range(n):
            for j in range(i + 1, n + 1):
                sub = s[i: j]
                nmap = {x: sub.count(x) for x in sub}
                ret += sum(j for j in nmap.values() if j == 1)
        return ret



